﻿using FastMapper.Configuration;
using FastMapper.Core;
using FastMapper.UnitTests.TestEntities;
using FluentAssertions;
using NUnit.Framework;

namespace FastMapper.UnitTests.Configuration
{
    [TestFixture]
    public class TypeMapConfigurationTests
    {
        private readonly IMapperConfigurator _configurator = new FastMapperConfigurator();
        private ITypeMapConfigurator<ClassA, ClassB> _typeMapConfigurator;

        [TestFixtureSetUp]
        public void Init()
        {
            _typeMapConfigurator = _configurator.CreateMap<ClassA, ClassB>();
            _typeMapConfigurator.ForMember(c => c.Property2, conf => conf.MapFrom(a => a.Property3));

        }

        [Test(Description = @"the SourceType Must be CLassA")]
        public void ThenTheSourceTypeMustBeCLassA()
        {
            _typeMapConfigurator.SourceType.Type.Should().Be<ClassA>();
        }

        //[Test(Description = @"CLass A PropertyInfoAccessors must be Equals to Property Numbers")]
        //public void ThenCLassAReadOnlyPropertyInfosMustBeEqualsToPropertyNumbers()
        //{
        //    var classACount = new TypeInfo(typeof(ClassA)).PropertyInfoAccessors.Count;
        //    _typeMapConfigurator.SourceType.PropertyInfoAccessors.Count.Should().Be(classACount);
        //}

        [Test(Description = @"the destination type must be ClassB")]
        public void ThenTheDestinationTypeMustBeClassB()
        {
            _typeMapConfigurator.DestinationType.Type.Should().Be<ClassB>();
        }

        //[Test(Description = @"CLass B PropertyInfoAccessors must be Equals to Property Numbers")]
        //public void ThenCLassBReadOnlyPropertyInfosMustBeEqualsToPropertyNumbers()
        //{
        //    var classBCount = new TypeInfo(typeof(ClassB)).PropertyInfoAccessors.Count;
        //    _typeMapConfigurator.DestinationType.PropertyInfoAccessors.Count.Should().Be(classBCount);
        //}

    }
}
